import { Component, OnInit } from '@angular/core';
import * as WaveSurfer from "wavesurfer.js";
@Component({
  selector: 'app-music-player',
  templateUrl: './music-player.component.html',
  styleUrls: ['./music-player.component.scss']
})
export class MusicPlayerComponent implements OnInit {
  size='medium'
  completed = false; // 发送完成
  wavesurfer:any;
  constructor() { }

  ngOnInit() {
    if(!this.wavesurfer){
      this.wavesurfer = WaveSurfer.create({
        container: "#waveform",
        waveColor: "violet",
        progressColor: "purple",
      });
    }

    this.wavesurfer.load("./assets/music/丁芙妮 - 怎么了 (原唱_ 周杰伦).mp3");
  }
  prev(){
    this.wavesurfer.load("./assets/music/丁芙妮 - 怎么了 (原唱_ 周杰伦).mp3");
  }
  play(){
    this.wavesurfer.playPause();
 }
  next(){
    this.wavesurfer.load("./assets/music/Sasha Sloan - Runaway (Explicit).mp3");
    
    // this.wavesurfer.play();
  }

}
